package com.reworkssm.mybatisdemo.persistence;

import com.reworkssm.mybatisdemo.domain.Product;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ProductMapper {

    List<Product> getProductListByCategory(String categoryId);

    Product getProduct(String productId);

    List<Product> searchProductList(String keywords);



/*    int getStock(@Param("productId") String productId);*/

    //ProductMapper
    int deleteByPrimaryKey(Integer id);

    int insert(Product record);

    int insertSelective(Product record);

    Product selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Product record);

    int updateByPrimaryKey(Product record);

    List<Product> selectProductList();

    List<Product> selectProductListByProductNameAndProductId(@Param("productName") String productName,
                                                             @Param("productId") Integer productId);

    List<Product> selectProductListByProductNameAndCategoryIds(@Param("productName") String productName,
                                                               @Param("categoryIdList") List<Integer> categoryIdList);
}
